package com.ww.scm.entity.mat;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.ww.scm.entity.AbstractEntity;
import com.ww.scm.entity.pub.Dictionary;

@Entity
@Table(name = "T_FINANCE_WASTEBOOK")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
// 业务单据
public class FinanceWastebook extends AbstractEntity {

	
	//账号
	private FinanceAccount account;
	// 收支类别
	private Dictionary inoutType; 
	// 收支项目
	private Dictionary inoutItem; 
	//余款
	private Double money=0.0;
	//是否自动生成
	private String auto;
	//单据
	private Bill bill;
	//单据业务类型
	private Dictionary businessType;
	//事务
	private Transaction transaction; 
	//事务明细
	private TransactionDetail transactionDetail;
	//冲红标识
	private String rollbackFlag;
	
	//打款类别
	private Dictionary inAccountItem;
	
	//打款方式
	private Dictionary inAccountMethod;
	
	//所属门店
	private Dictionary shop;
	
	//资金形式
	private Dictionary accountType;
	
	//事务日期
	private String inOutDate;
	
	public FinanceWastebook() {
	}

	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_ACCOUNT_ID")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public FinanceAccount getAccount() {
		return account;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_INOUT_TYPE")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getInoutType() {
		return inoutType;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_INOUT_ITEM")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getInoutItem() {
		return inoutItem;
	} 

	@Column(name = "F_MONEY",  precision = 12, scale = 4)
	public Double getMoney() {
		return money;
	}
	
	@Column(name="F_AUTO",length = 1)
	public String getAuto() {
		return auto;
	}
	

	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_BILL_ID")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Bill getBill() {
		return bill;
	} 
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_BUSINESS_TYPE")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getBusinessType() {
		return businessType;
	} 
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_TRANSATION_ID")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Transaction getTransation() {
		return transaction;
	} 
	
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_TRANSATION_DETAIL_ID")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public TransactionDetail getTransationDetail() {
		return transactionDetail;
	} 
	
	@Column(name="F_INOUT_DATE",length = 8)
	public String getInOutDate() {
		return inOutDate;
	}
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_IN_ACCOUNT_METHOD")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getInAccountMethod() {
		return inAccountMethod;
	} 
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_SHOP")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getShop() {
		return shop;
	} 
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_ACCOUNT_TYPE")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getAccountType() {
		return accountType;
	} 
	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
	@JoinColumn(name = "F_IN_ACCOUNT_ITEM")
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) 
	public Dictionary getInAccountItem() {
		return inAccountItem;
	} 
	
	@Column(name="F_ROLLBACK_FLAG",length = 8)
	public String getRollbackFlag() {
		return rollbackFlag;
	}
	
	public void setAccount(FinanceAccount account) {
		this.account = account;
	}
	
	public void setInoutType(Dictionary inoutType) {
		this.inoutType = inoutType;
	}
	
	
	public void setInoutItem(Dictionary inoutItem) {
		this.inoutItem = inoutItem;
	}
	
	public void setMoney(Double money) {
		this.money = money;
	}
	
	public void setAuto(String auto) {
		this.auto = auto;
	}

	public void setBill(Bill bill){
		this.bill=bill;
	}
	
	public void setBusinessType(Dictionary businessType){
		this.businessType=businessType;
	}
	 
	public void setTransation(Transaction transaction){
		this.transaction=transaction;
	}
	
	public void setTransationDetail(TransactionDetail transactionDetail){
		this.transactionDetail=transactionDetail;
	}
	
	public void setRollbackFlag(String rollbackFlag){
		this.rollbackFlag=rollbackFlag;
	}
	
	public void setInAccountItem(Dictionary inAccountItem){
		this.inAccountItem=inAccountItem;
	}
	
	public void setInAccountMethod(Dictionary inAccountMethod){
		this.inAccountMethod=inAccountMethod;
	}
	
	public void setShop(Dictionary shop){
		this.shop=shop;
	}
	
	public void setAccountType(Dictionary accountType){
		this.accountType=accountType;
	}
	
	public void setInOutDate(String inOutDate){
		this.inOutDate=inOutDate;
	}

}
